
import Cookies from 'js-cookie'//控制cookie的插件
import {get} from "./request"
export const getToken=()=>{//获取token
    return Cookies.get("MTOKEN")
}
export const setToken=(data,expires=3,path='/')=>{//设置token
    Cookies.set("MTOKEN", data, {
        expires,
        path
    })
}
export const isToken=()=>Cookies.get("MTOKEN")?true:false //本地是否有token

export const removeToken = () => Cookies.remove("MTOKEN") //删除token

export const TokenIsLogin =async()=>{
   let c=  await get("/api/v1/user/info")
   return c.code===1?true:false
}